
//GET DAILY SALES

function main(workbook: ExcelScript.Workbook, wsName: string, startCellName: string) {

//Get the first cell with data
let startCell = workbook.getWorksheet(wsName).getRange(startCellName)

//Expand to select the entire range with data
let dataRange = startCell.getExtendedRange(ExcelScript.KeyboardDirection.down).getExtendedRange(ExcelScript.KeyboardDirection.right)

//Get the values fromt he range
let dataValues = dataRange.getValues()

return dataValues

}





//REPLACE DATA IN TABLE

function main(workbook: ExcelScript.Workbook, tblName: string, data: string) {

let tbl = workbook.getTable(tblName)

//Delete data in the table
tbl.getRangeBetweenHeaderAndTotal().delete(ExcelScript.DeleteShiftDirection.up)

//Convert the strArr to an array
let getData: string[][] = JSON.parse(data);

//Add data to end of Table
tbl.addRows(null, getData)

}



//GET CELL TEXT

function main(workbook: ExcelScript.Workbook, wsName: string, rngName: string) {

//Return the value from the cell
return workbook.getWorksheet(wsName).getRange(rngName).getValue()

}

